package com.GUI.lesson03;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

//画笔
public class TextPaint {
    public static void main(String[] args) {
        new Mypaint().loadFrame();
    }
}
//画笔
class Mypaint extends Frame{


    //方法
    public void loadFrame(){
        setVisible(true);
        setBounds(200,200,600,500);
        //关闭
        addWindowListener(new WindowAdapter() {
            //窗口点击关闭后需要做的事情
            @Override
            public void windowClosing(WindowEvent e) {
                //结束程序
                System.exit(0);
            }
        });
    }



    @Override
    public void paint(Graphics g) {
        //画笔颜色
        g.setColor(Color.red);
        g.drawOval(100,100,100,100);
        g.fillOval(200,200,100,100);
        //养成习惯，画笔用完记得恢复默认颜色
    }
}



